package cz.acies.organizer.data.model;

import java.util.ArrayList;
import java.util.List;

import cz.acies.data.persist.ModelObject;
import cz.acies.data.persist.TreeNode;

public class MModelFolder extends TreeNode
{
	private static final long serialVersionUID = -5549080966844608155L;
	/*
	protected String id;
	protected String name;
	protected MModelFolder parent;
	protected ArrayList<MModelFolder> children;
	*/
	protected List<MModelRecord> records = new ArrayList<MModelRecord>();
	
	public MModelFolder(String id, String text) {
		super(id, text);
		/*
		this.id = id;
		this.name = name;
		children = new ArrayList<MModelFolder>();
		*/
	}
	/*
	public String getName() {
		return name;
	}

	public void setParent(MModelFolder parent) {
		this.parent = parent;
	}
	
	public MModelFolder getParent() {
		return parent;
	}
	*/
	// -----  -----------------------------------------------------------------
	/*
	public void addChild(MModelFolder child) {
		children.add(child);
		child.setParent(this);
	}

	public void removeChild(MModelFolder child) {
		children.remove(child);
		child.setParent(null);
	}
	
	public MModelFolder[] getChildren() {
		return (MModelFolder[]) children.toArray(new MModelFolder[children.size()]);
	}
	
	public boolean hasChildren() {
		return children.size()>0;
	}
	*/
	// -----  -----------------------------------------------------------------
	/*
	public String toString() {
		return getName();
	}
	*/
	// -----  -----------------------------------------------------------------
	
	public void addRecord(MModelRecord record) {
		records.add(record);
	}
	
	public void removeRecord(MModelRecord record) {
		records.remove(record);
	}
	
	public List<MModelRecord> getRecords() {
		return records;
	}

	public void setRecords(List<MModelRecord> records) {
		this.records = records;
	}

	public void addRecords(List<MModelRecord> records) {
		this.records.addAll(records);
	}

	public void addRecords(int index, List<MModelRecord> records) {
		this.records.addAll(index, records);
	}

	public boolean hasRecords() {
		return records.size() > 0;
	}
}
